
clear
clear matrix
set more off
cap log close
set matsize  800


global FE_NAME   "METRO"
global FE_LEVEL  "metarea"
global GEO_SET   "gen GEO_LEVEL =  "METRO""




use  ${FE_NAME}_black_men_mainvarbs


sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_black_females_mainvarbs
tab  _merge
drop _merge 

sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_females_mainvarbs
tab  _merge
drop _merge 

sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_white_men_mainvarbs     
tab  _merge
drop _merge 

sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_all_men_mainvarbs     
tab  _merge
drop _merge 


sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_white_men_ineq    
tab  _merge
drop _merge 

sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_black_men_ineq     
tab  _merge
drop _merge 


sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_demog_data     
tab  _merge
drop _merge 


sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_white_men_bartik_mfg     
tab  _merge
drop _merge 


sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_ROR_gapx_men     
tab  _merge
drop _merge 

sort   $FE_LEVEL year
merge  $FE_LEVEL year    using ${FE_NAME}_ROR_gapx_FEM     
tab  _merge
drop _merge
drop _merge* 

rename metro_statefip  statefip
sort  statefip
merge statefip  using   "statefip_region_subregion.dta" 
tab  _merge
drop _merge




*************************************************************************************************************************************


gen  blackfem_teen_mom_1  = black_teen_mom_1
gen       fem_teen_mom_1  =       teen_mom_1


foreach  varb1 in   HSD     HSG    COD    COG   age_25_34    age_35_44   age_45_55 {
gen gapfem_`varb1' =  blackfem_`varb1' - fem_`varb1'
gen    gap_`varb1' =     black_`varb1' - `varb1'
}

  

global  SPEC_1            "              age_25_34          age_35_44          age_45_55   i.year"
global  BLACK_SPEC_1      "        black_age_25_34    black_age_35_44    black_age_45_55   i.year"
global  ALL_SPEC_1        "      all_men_age_25_34  all_men_age_35_44  all_men_age_45_55   i.year"

global  FEM_SPEC_1        "           fem_age_25_34       fem_age_35_44       fem_age_45_55   i.year"
global  BLACKFEM_SPEC_1   "      blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year"

global     GAP_SPEC_1            "        gap_age_25_34       gap_age_35_44       gap_age_45_55   i.year"
global  GAPFEM_SPEC_1            "     gapfem_age_25_34    gapfem_age_35_44    gapfem_age_45_55   i.year"




global  INEQ_VARBLIST     "tot_9010   tot_9050  tot_5010   tot_lincwage_90   tot_lincwage_50  tot_lincwage_10	 res_educ_9010   res_educ_9050     res_educ_5010   res_educ_90   res_educ_50	  res_educ_10        res_occ_ind_90   res_occ_ind_50	 res_occ_ind_10     res_occ_ind_9010   		res_occ_ind_9050   	res_occ_ind_5010       res_metro_90  res_metro_50	 res_metro_10		res_metro_9010   res_metro_9050   	res_metro_5010    std_hvalue    "
global  VARBLIST_GENDER   "CHILD_poor   CHILD_one_parent   teen_mom_1 "
global  VARB_GAP_FEM      " nevermar  poor  single_mom           teen_mom_1   lincwage  emprate  emprate_noncog  welfare_dummy  divorced_1  widowed_2   home_owner  lvalueh   ror_nevermar   ror_single_mom"
global  VARB_GAP_MEN      " lincwage  tot_lincwage_90    tot_lincwage_50   tot_lincwage_10   res_educ_90  res_educ_50  res_educ_10  married_1  divorced_1  widowed_2  nevermar  groupq  emprate  emprate_noncog   home_owner  lvalueh  poor  welfare_dummy   std_hvalue   tot_9010   res_educ_9010  res_occ_ind_9010  res_metro_9010   ror_lincwage	  ror_lvalueh	  ror_emprate		  ror_nevermar	ror_groupq "


*************************************************************************************************************************************


foreach varb1 in $VARB_GAP_MEN  $VARBLIST_GENDER  {
gen    gap_`varb1' =  black_`varb1' -  `varb1'
}

foreach varb1 in $VARB_GAP_FEM  {
gen    gapfem_`varb1' =  blackfem_`varb1' -  fem_`varb1'
}


*************************************************************************************************************************************



gen x_1 = black_pop if year==1990
egen black_pop_1990 = max(x_1), by($FE_LEVEL)
drop x_1

gen x_1 = pop if year==1990
egen white_pop_1990 = max(x_1), by($FE_LEVEL)
drop x_1


gen IV_mfg_1960 = bartik_IV_mfg_1960
gen IV_mfg_1970 = bartik_IV_mfg_1970
gen IV_mfg_1980 = bartik_IV_mfg_1980
gen IV_mfg_1990 = bartik_IV_mfg_1990



global   BLACK_SAMPLE  "& black_nobs>=50  [aw=black_pop_1990]"
global   WHITE_SAMPLE  "&       nobs>=50  [aw=white_pop_1990]"
global   GAP_SAMPLE    "& black_nobs>=50 & nobs>=50  [aw=  black_pop_1990]"


*************************************************************************************************************************************




****************************************************************************
*  TABLE 1 - BLACK CORE RESULTS -- OLS and IV with Different BASE YEARS
****************************************************************************

global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"



* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              $BLACK_SPEC_1                           if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              $BLACKFEM_SPEC_1                        if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = IV_mfg_`yearx')           $BLACK_SPEC_1               if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = IV_mfg_`yearx')           $BLACKFEM_SPEC_1            if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}








***********************************************************************************
*  TABLE 2 - BLACK MEN AND WOMEN  MORE OUTCOMES -- OLS and IV with BASE YEAR 1960
***********************************************************************************


global ALL_VARBS   "lincwage   emprate_noncog  poor  welfare_dummy  divorced_1  widowed_2   home_owner  lvalueh  teen_mom_1 " 



* OLS

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg      black_`varb1'       black_mfg                        $BLACK_SPEC_1                           if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}

* IV

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    black_`varb1'      (black_mfg = IV_mfg_1960)        $BLACK_SPEC_1                           if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}




* OLS

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg      blackfem_`varb1'       black_mfg                     $BLACKFEM_SPEC_1                         if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}

* IV

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    blackfem_`varb1'      (black_mfg = IV_mfg_1960)     $BLACKFEM_SPEC_1                         if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}








*********************************************************************************************
*  TABLE 3 - BLACK INEQUALITY RESULTS -- OLS and IV with Different BASE YEARS
*********************************************************************************************

global MEN_VARBS   "tot_9010  std_hvalue  ror_lincwage  ror_nevermar  ror_emprate "
global FEM_VARBS   "ror_nevermar   ror_single_mom"



* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      black_`varb1'       black_mfg                              $BLACK_SPEC_1                             if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      blackfem_`varb1'       black_mfg                              $BLACKFEM_SPEC_1                        if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    black_`varb1'      (black_mfg = IV_mfg_`yearx')           $BLACK_SPEC_1                  if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    blackfem_`varb1'      (black_mfg = IV_mfg_`yearx')           $BLACKFEM_SPEC_1            if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}







*********************************************************************************************
*  TABLE 4 - WHITE CORE RESULTS -- OLS and IV with Different BASE YEARS
*********************************************************************************************

global MEN_VARBS   "lincwage  emprate  nevermar"
global FEM_VARBS   "fem_nevermar  fem_poor  fem_single_mom  CHILD_poor  CHILD_one_parent"



* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       mfg                              $SPEC_1                           if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       mfg                              $FEM_SPEC_1                        if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_`yearx')           $SPEC_1               if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_`yearx')           $FEM_SPEC_1            if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}






*********************************************************************************************
*  TABLE 5 - WHITE MEN AND WOMEN  MORE OUTCOMES -- OLS and IV with BASE YEAR 1960
*********************************************************************************************


global ALL_VARBS   "lincwage   emprate_noncog  poor  welfare_dummy  divorced_1  widowed_2   home_owner  lvalueh  teen_mom_1 " 



* OLS MEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg      `varb1'       mfg                              $SPEC_1                           if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}

* IV  MEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_1960)           $SPEC_1               if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}




* OLS WOMEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg      fem_`varb1'       mfg                              $FEM_SPEC_1                        if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}

* IV WOMEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    fem_`varb1'      (mfg = IV_mfg_1960)             $FEM_SPEC_1                        if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}







*********************************************************************************************
*  TABLE 6 - WHITE INEQUALITY RESULTS -- OLS and IV with Different BASE YEARS
*********************************************************************************************

global MEN_VARBS   "tot_9010  std_hvalue  ror_lincwage  ror_nevermar  ror_emprate "
global FEM_VARBS   "ror_nevermar   ror_single_mom"


* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       mfg                              $SPEC_1                           if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      fem_`varb1'       mfg                              $FEM_SPEC_1                        if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_`yearx')           $SPEC_1               if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    fem_`varb1'      (mfg = IV_mfg_`yearx')           $FEM_SPEC_1            if year>=`yearx'  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}




*********************************************************************************************
*  TABLE 7 - BLACK-WHITE GAP  CORE RESULTS -- OLS and IV with Different BASE YEARS
*********************************************************************************************



global MEN_VARBS     "gap_lincwage  gap_emprate  gap_nevermar"
global FEM_VARBS     "gapfem_nevermar  gapfem_poor  gapfem_single_mom  "
global CHILD_VARBS   "gap_CHILD_poor  gap_CHILD_one_parent"

global  MFG_VARB  "all_men_mfg"

							
* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       $MFG_VARB                              $GAP_SPEC_1                                          if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $CHILD_VARBS  {
xi:   xtreg      `varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_`yearx')           $GAP_SPEC_1                                          if year>=`yearx'  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_`yearx')           $GAPFEM_SPEC_1                                       if year>=`yearx'   $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $CHILD_VARBS  {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_`yearx')           $GAPFEM_SPEC_1                                       if year>=`yearx'   $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}




*******************************************************************************************************
*  TABLE 8 - BLACK-WHITE GAP  IN LEVELS  MORE OUTCOMES -- OLS and IV with 1960 BASE YEAR
*******************************************************************************************************

global ALL_VARBS    "lincwage   emprate_noncog  poor  welfare_dummy  divorced_1  widowed_2   home_owner  lvalueh  teen_mom_1 " 
global  MFG_VARB    "all_men_mfg"
global  WT_SAMPLE   "$GAP_SAMPLE"

							
* OLS  MEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg         gap_`varb1'       $MFG_VARB                              $GAP_SPEC_1                                          if year>=1960  $WT_SAMPLE,  fe i($FE_LEVEL) robust   
}


* IV  MEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    gap_`varb1'         ($MFG_VARB = IV_mfg_1960)           $GAP_SPEC_1                                          if year>=1960  $WT_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}




*  OLS WOMEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtreg      gapfem_`varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=1960  $WT_SAMPLE,  fe i($FE_LEVEL) robust   
}



* IV  WOMEN

foreach varb1  in    $ALL_VARBS    {
xi:   xtivreg2    gapfem_`varb1'      ($MFG_VARB = IV_mfg_1960)           $GAPFEM_SPEC_1                                       if year>=1960   $WT_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}





****************************************************************************************
*  TABLE 9 - BLACK-WHITE GAP  IN INEQUALITY -- OLS and IV with Different BASE YEARS
****************************************************************************************

global MEN_VARBS   "tot_9010  std_hvalue  ror_lincwage  ror_nevermar  ror_emprate "
global FEM_VARBS   "ror_nevermar   ror_single_mom"
global  MFG_VARB  "all_men_mfg"


							
* OLS

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg         gap_`varb1'       $MFG_VARB                              $GAP_SPEC_1                                          if year>=`yearx'  $WT_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      gapfem_`varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=`yearx'  $WT_SAMPLE,  fe i($FE_LEVEL) robust   
}
}

* IV

foreach  yearx in  1960  1970  1980  1990	{					
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    gap_`varb1'         ($MFG_VARB = IV_mfg_`yearx')           $GAP_SPEC_1                                          if year>=`yearx'  $WT_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    gapfem_`varb1'      ($MFG_VARB = IV_mfg_`yearx')           $GAPFEM_SPEC_1                                       if year>=`yearx'   $WT_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}





****************************************************************************************
*  TABLE 10 - Mortality Analysis
****************************************************************************************

preserve
													 

gen    msafip = metarea*10
sort   msafip year
merge  msafip year   using  "cdc_mortality_MSA_COUNTY_AGE.dta" 
drop _merge

foreach  varb1 in death_rate_1 death_rate_2  {
replace             `varb1' =          `varb1'*1000
replace       black_`varb1' =    black_`varb1'*1000
replace         fem_`varb1' =      fem_`varb1'*1000
replace    blackfem_`varb1' = blackfem_`varb1'*1000
}



foreach  varb  in  death_rate_1  death_rate_2  {
gen  gap_`varb'     =  black_`varb' - `varb'
gen  gapfem_`varb'  =  blackfem_`varb' - fem_`varb'
}

 
global   MEN_VARBS     "death_rate_2"
global   MORT_AGES     "age_cat>=3 & age_cat<=9"




foreach  yearx in  1970  	{					
foreach varb1  in    $MEN_VARBS    {
xi:  xtreg          black_`varb1'              black_mfg                               $BLACK_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=   black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2        black_`varb1'             ( black_mfg = IV_mfg_`yearx')           $BLACK_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=   black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)
							   
xi:  xtreg       blackfem_`varb1'              black_mfg                               $BLACKFEM_SPEC_1    i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2     blackfem_`varb1'             ( black_mfg = IV_mfg_`yearx')           $BLACKFEM_SPEC_1    i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)

							   
							   
xi:  xtreg                `varb1'              mfg                                     $SPEC_1             i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= cdc_pop_2000],          fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2              `varb1'             (       mfg = IV_mfg_`yearx')           $SPEC_1             i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= cdc_pop_2000],          fe i(countyfip) robust  cluster(metarea)

							   
xi:  xtreg            fem_`varb1'              mfg                                     $FEM_SPEC_1         i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= fem_cdc_pop_2000],      fe i(countyfip) robust  cluster(metarea) 
							   
xi:  xtivreg2          fem_`varb1'             (       mfg = IV_mfg_`yearx')           $FEM_SPEC_1         i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=     fem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)

							   
xi:  xtreg             gap_`varb1'                all_men_mfg                          $GAP_SPEC_1       i.age_cat          if $MORT_AGES &  year>=`yearx'      [aw=      black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2          gap_`varb1'             ( all_men_mfg = IV_mfg_`yearx')         $GAP_SPEC_1       i.age_cat          if $MORT_AGES &  year>=`yearx'      [aw=      black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)


xi:  xtreg          gapfem_`varb1'                all_men_mfg                            $GAPFEM_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'   [aw=   blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2       gapfem_`varb1'             ( all_men_mfg = IV_mfg_`yearx')           $GAPFEM_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'   [aw=   blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)
							   
}
}



global   MORT_AGES     "age_cat>=0 & age_cat<=2"





foreach  yearx in  1970  	{					
foreach varb1  in    $MEN_VARBS    {

xi:  xtreg          black_`varb1'              black_mfg                               $BLACK_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=   black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2        black_`varb1'             ( black_mfg = IV_mfg_`yearx')           $BLACK_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=   black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)
							   
xi:  xtreg       blackfem_`varb1'              black_mfg                               $BLACKFEM_SPEC_1    i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2     blackfem_`varb1'             ( black_mfg = IV_mfg_`yearx')           $BLACKFEM_SPEC_1    i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)

							   
							   
xi:  xtreg                `varb1'              mfg                                     $SPEC_1             i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= cdc_pop_2000],          fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2              `varb1'             (       mfg = IV_mfg_`yearx')           $SPEC_1             i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= cdc_pop_2000],          fe i(countyfip) robust  cluster(metarea)

							   
xi:  xtreg            fem_`varb1'              mfg                                     $FEM_SPEC_1         i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw= fem_cdc_pop_2000],      fe i(countyfip) robust  cluster(metarea) 							   
xi:  xtivreg2          fem_`varb1'             (       mfg = IV_mfg_`yearx')           $FEM_SPEC_1         i.age_cat        if $MORT_AGES &  year>=`yearx'      [aw=     fem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)

							   
xi:  xtreg             gap_`varb1'                all_men_mfg                          $GAP_SPEC_1       i.age_cat          if $MORT_AGES &  year>=`yearx'      [aw=      black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2          gap_`varb1'             ( all_men_mfg = IV_mfg_`yearx')         $GAP_SPEC_1       i.age_cat          if $MORT_AGES &  year>=`yearx'      [aw=      black_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)


xi:  xtreg          gapfem_`varb1'                all_men_mfg                            $GAPFEM_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'   [aw=   blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea) 
xi:  xtivreg2       gapfem_`varb1'             ( all_men_mfg = IV_mfg_`yearx')           $GAPFEM_SPEC_1       i.age_cat        if $MORT_AGES &  year>=`yearx'   [aw=   blackfem_cdc_pop_2000],  fe i(countyfip) robust  cluster(metarea)
							   
}
}


restore



******************************************************************************************************************************************************************************************************************************




****************************************************************************************
* APPENDIX TABLE 1, 2, AND 3:  DESCRIPTIVE STATISTICS
****************************************************************************************


global BLACK_MEN_DESC_VARBS   "black_lincwage  black_emprate  black_nevermar  black_tot_lincwage_50    black_emprate_noncog  black_poor  black_welfare_dummy  black_divorced_1  black_groupq   black_home_owner  black_lvalueh  black_mfg  black_services  black_HSD  black_HSG  black_COD  black_COG    black_educ_n "
global WHITE_MEN_DESC_VARBS   "      lincwage        emprate        nevermar        tot_lincwage_50          emprate_noncog        poor        welfare_dummy        divorced_1        groupq         home_owner        lvalueh        mfg  services        HSD        HSG        COD        COG          educ_n "


bysort year: sum    $BLACK_MEN_DESC_VARBS  [aw=black_pop] if   !mi(black_mfg)  &  black_nobs>=50
bysort year: sum    $WHITE_MEN_DESC_VARBS  [aw=white_pop] if   !mi(mfg)        &        nobs>=50




global WHITEFEM_DESC_VARBS    "     fem_nevermar       fem_poor       fem_single_mom       fem_teen_mom_1        fem_lincwage       fem_emprate       fem_welfare_dummy       fem_divorced_1       fem_widowed_2        fem_home_owner       fem_lvalueh        fem_mfg         fem_services          fem_HSD       fem_HSG       fem_COD       fem_COG        fem_educ_n          CHILD_poor        CHILD_one_parent  "
global BLACKFEM_DESC_VARBS    "blackfem_nevermar  blackfem_poor  blackfem_single_mom  blackfem_teen_mom_1   blackfem_lincwage  blackfem_emprate  blackfem_welfare_dummy  blackfem_divorced_1  blackfem_widowed_2   blackfem_home_owner  blackfem_lvalueh   blackfem_mfg    blackfem_services     blackfem_HSD  blackfem_HSG  blackfem_COD  blackfem_COG   blackfem_educ_n    black_CHILD_poor  black_CHILD_one_parent  "

bysort year: sum    $BLACKFEM_DESC_VARBS  [aw=black_pop] if      black_nobs>=50
bysort year: sum    $WHITEFEM_DESC_VARBS  [aw=white_pop] if            nobs>=50




global  WHITE_INEQ_DESC        "      tot_lincwage_90        tot_lincwage_10        tot_9010        res_educ_9010        std_hvalue        ror_lincwage        ror_nevermar        ror_emprate          fem_ror_nevermar        fem_ror_single_mom"
global  BLACK_INEQ_DESC        "black_tot_lincwage_90  black_tot_lincwage_10  black_tot_9010  black_res_educ_9010  black_std_hvalue  black_ror_lincwage  black_ror_nevermar  black_ror_emprate     blackfem_ror_nevermar   blackfem_ror_single_mom"


bysort year: eststo: estpost   sum    $BLACK_INEQ_DESC  [aw=black_pop] if      black_nobs>=50
bysort year: eststo: estpost   sum    $WHITE_INEQ_DESC  [aw=white_pop] if            nobs>=50





**********************************************************************
*  APPENDIX TABLE 4  - BLACK CORE RESULTS -- SENSITIVITY TO CONTROLS
**********************************************************************

global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"
global STARTYR     "1960"

gen lpop = log(pop)




foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              i.year                                  if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              i.year                                  if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
							

foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_age_25_34     black_age_35_44     black_age_45_55      i.year               if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year               if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}



foreach varb1  in    $MEN_VARBS    {
xi:     reg      `varb1'       black_mfg                              black_age_25_34     black_age_35_44     black_age_45_55      i.year      i.$FE_LEVEL         if year>=$STARTYR  $BLACK_SAMPLE,   robust  cluster(Subregion) 
}
foreach varb1  in    $FEM_VARBS    {
xi:     reg      `varb1'       black_mfg                              blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year      i.$FE_LEVEL         if year>=$STARTYR  $BLACK_SAMPLE,   robust  cluster(Subregion)
}

							
														
foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year               if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year               if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}



foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year     black_services          if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year     black_services         if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}


foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year     black_services   lpop       if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year     black_services   lpop      if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}




gen x_1 = black_mfg  if year==1960
egen black_mfg_1960 = max(x_1), by($FE_LEVEL)
drop x_1
gen  black_mfg_1960_year = black_mfg_1960*year


foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year     black_mfg_1960_year          if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year     black_mfg_1960_year          if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}



foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year     i.Region*i.year              if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year     i.Region*i.year              if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}



foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              black_HSD       black_HSG      black_COD     black_COG      black_age_25_34     black_age_35_44     black_age_45_55      i.year     i.${FE_LEVEL}*year           if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg                              blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year     i.${FE_LEVEL}*year           if year>=$STARTYR  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}






	  



***************************************************************************************************************************************
*  APPENDIX TABLE 5 - HORSERACE BETWEEN MFG AND SERVICES with 1960 BASE YEAR
***************************************************************************************************************************************




**********
* BLACKS
**********

global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"



foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       black_mfg    black_services                          $BLACK_SPEC_1                           if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       black_mfg    black_services                          $BLACKFEM_SPEC_1                        if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}



**********
* WHITES
**********


global MEN_VARBS   "lincwage  emprate  nevermar"
global FEM_VARBS   "fem_nevermar  fem_poor  fem_single_mom  CHILD_poor  CHILD_one_parent"



foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       mfg         services                                     $SPEC_1                           if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       mfg         services                                    $FEM_SPEC_1                        if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust   
}


**********
* GAP  
**********


global MEN_VARBS     "gap_lincwage  gap_emprate  gap_nevermar"
global FEM_VARBS     "gapfem_nevermar  gapfem_poor  gapfem_single_mom  "
global CHILD_VARBS   "gap_CHILD_poor  gap_CHILD_one_parent"


global  MFG_VARB  "all_men_mfg"

							
* GAP - OLS

foreach varb1  in    $MEN_VARBS    {
xi:   xtreg      `varb1'       $MFG_VARB      all_men_services                        $GAP_SPEC_1                                          if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtreg      `varb1'       $MFG_VARB      all_men_services                        $GAPFEM_SPEC_1                                       if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}
foreach varb1  in    $CHILD_VARBS  {
xi:   xtreg      `varb1'       $MFG_VARB      all_men_services                        $GAPFEM_SPEC_1                                       if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust   
}







***************************************************************************************************************************************
*  APPENDIX TABLE 6 - BARTIK RESULTS with OTHER CONTROLS
***************************************************************************************************************************************



**********
* BLACKS
**********




global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"


foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = IV_mfg_1960    )           $BLACK_SPEC_1            black_HSD       black_HSG      black_COD     black_COG      black_services           if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}

foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = IV_mfg_1960    )           $BLACKFEM_SPEC_1         blackfem_HSD    blackfem_HSG   blackfem_COD  blackfem_COG   black_services           if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}





**********
* WHITES
**********


global MEN_VARBS   "lincwage  emprate  nevermar"
global FEM_VARBS   "fem_nevermar  fem_poor  fem_single_mom  CHILD_poor  CHILD_one_parent"



foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_1960    )           $SPEC_1            HSD       HSG      COD     COG           services           if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}

foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      (mfg = IV_mfg_1960    )           $FEM_SPEC_1         fem_HSD    fem_HSG   fem_COD  fem_COG   services           if year>=1960  $WHITE_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}



**********
* GAP  
**********


global MEN_VARBS     "gap_lincwage  gap_emprate  gap_nevermar"
global FEM_VARBS     "gapfem_nevermar  gapfem_poor  gapfem_single_mom  "
global CHILD_VARBS   "gap_CHILD_poor  gap_CHILD_one_parent"


global  MFG_VARB  "all_men_mfg"

	

foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAP_SPEC_1         gap_HSD         gap_HSG     gap_COD      gap_COG    all_men_services                                 if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAPFEM_SPEC_1      gapfem_HSG  gapfem_COD   gapfem_COG    all_men_services                                              if year>=1960   $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $CHILD_VARBS  {
xi:   xtivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAPFEM_SPEC_1      gapfem_HSG  gapfem_COD   gapfem_COG    all_men_services                                              if year>=1960   $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}






**********************************************************************
*  APPENDIX TABLE 7  - BARTIK IV
**********************************************************************



*
foreach indcode of numlist  2/17 {
gen gush_base_1960_ind_`indcode' = indshare_base_1960_`indcode'*indshare_overtime_`indcode'
}


gen  bartik_IV_1960_X = 0
foreach indcode of numlist  2/17 {
replace bartik_IV_1960_X = bartik_IV_1960_X + indshare_base_1960_`indcode'*indshare_overtime_`indcode'
}

foreach indcode of numlist  2/17 {
gen bartik_IV_1960_X_`indcode' = bartik_IV_1960_X -  indshare_base_1960_`indcode'*indshare_overtime_`indcode'
}


global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"





foreach indcode of numlist  2/17 {
foreach varb1  in    $MEN_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = bartik_IV_1960_X_`indcode')           $BLACK_SPEC_1               if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   xtivreg2    `varb1'      (black_mfg = bartik_IV_1960_X_`indcode')           $BLACKFEM_SPEC_1            if year>=1960  $BLACK_SAMPLE,  fe i($FE_LEVEL) robust cluster($FE_LEVEL)     
}
}






***************************************************************************************************************************************
*  APPENDIX TABLE 8 and 9  - Adjusting for Multiple Hypotheses
***************************************************************************************************************************************



* Black Men


wyoung black_lincwage  black_emprate  black_nevermar black_emprate_noncog  black_poor  black_welfare_dummy  black_divorced_1  black_widowed_2  black_home_owner  black_lvalueh  black_tot_9010  black_std_hvalue black_ror_lincwage  black_ror_nevermar  black_ror_emprate , cmd(xi: regress OUTCOMEVAR black_mfg  $BLACK_SPEC_1 i.metarea if year>=1960 $BLACK_SAMPLE, cluster(metarea)) cluster(metarea) familyp(black_mfg) bootstraps(500) seed(20) 
	  

* Black Women


wyoung blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent   blackfem_teen_mom_1  blackfem_lincwage  blackfem_emprate_noncog   blackfem_welfare_dummy  blackfem_divorced_1  blackfem_widowed_2   blackfem_home_owner  blackfem_lvalueh  blackfem_ror_nevermar   blackfem_ror_single_mom , cmd(xi: regress OUTCOMEVAR black_mfg  $BLACKFEM_SPEC_1 i.metarea if year>=1960 $BLACK_SAMPLE, cluster(metarea)) cluster(metarea) familyp(black_mfg) bootstraps(500) seed(20) 


* White Men

wyoung lincwage  emprate  nevermar emprate_noncog  poor  welfare_dummy  divorced_1  widowed_2  home_owner  lvalueh  tot_9010  std_hvalue ror_lincwage  ror_nevermar  ror_emprate , cmd(xi: regress OUTCOMEVAR mfg  $SPEC_1 i.metarea if year>=1960 $WHITE_SAMPLE, cluster(metarea)) cluster(metarea) familyp(mfg) bootstraps(500) seed(20) 


* White Females

wyoung fem_nevermar  fem_poor  fem_single_mom  CHILD_poor  CHILD_one_parent   fem_teen_mom_1  fem_lincwage  fem_emprate_noncog  fem_welfare_dummy  fem_divorced_1  fem_widowed_2   fem_home_owner  fem_lvalueh  fem_ror_nevermar   fem_ror_single_mom , cmd(xi: regress OUTCOMEVAR mfg  $FEM_SPEC_1 i.metarea if year>=1960 $WHITE_SAMPLE, cluster(metarea)) cluster(metarea) familyp(mfg) bootstraps(500) seed(20) 



* Gap Men

wyoung gap_lincwage  gap_emprate  gap_nevermar gap_emprate_noncog  gap_poor  gap_welfare_dummy  gap_divorced_1  gap_widowed_2  gap_home_owner  gap_lvalueh  gap_tot_9010  gap_std_hvalue gap_ror_lincwage  gap_ror_nevermar  gap_ror_emprate , cmd(xi: regress OUTCOMEVAR all_men_mfg  $GAP_SPEC_1 i.metarea if year>=1960 $BLACK_SAMPLE, cluster(metarea)) cluster(metarea) familyp(all_men_mfg) bootstraps(500) seed(20) 

* Gap Females

wyoung gapfem_nevermar  gapfem_poor  gapfem_single_mom  gap_CHILD_poor  gap_CHILD_one_parent   gapfem_teen_mom_1  gapfem_lincwage  gapfem_emprate_noncog  gapfem_welfare_dummy  gapfem_divorced_1  gapfem_widowed_2   gapfem_home_owner  gapfem_lvalueh  gapfem_ror_nevermar   gapfem_ror_single_mom , cmd(xi: regress OUTCOMEVAR all_men_mfg  $GAPFEM_SPEC_1 i.metarea if year>=1960 $BLACK_SAMPLE, cluster(metarea)) cluster(metarea) familyp(all_men_mfg) bootstraps(500) seed(20) 






***************************************************************************************************************************************
*  APPENDIX TABLE 10 - FIRST DIFFS   - CORE RESULTS -- BLACKS, WHITES, and GAP  --  OLS and IV with 1960 BASE YEAR
***************************************************************************************************************************************




global  SPEC_1            "              age_25_34          age_35_44          age_45_55   "
global  BLACK_SPEC_1      "        black_age_25_34    black_age_35_44    black_age_45_55   "
global  ALL_SPEC_1        "      all_men_age_25_34  all_men_age_35_44  all_men_age_45_55   "

global  FEM_SPEC_1        "           fem_age_25_34       fem_age_35_44       fem_age_45_55   "
global  BLACKFEM_SPEC_1   "      blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   "

global     GAP_SPEC_1            "        gap_age_25_34       gap_age_35_44       gap_age_45_55   "
global  GAPFEM_SPEC_1            "     gapfem_age_25_34    gapfem_age_35_44    gapfem_age_45_55   "


sort metarea year
foreach varb1 in $SPEC_1  $BLACK_SPEC_1  $ALL_SPEC_1  $FEM_SPEC1  $BLACKFEM_SPEC_1  $GAP_SPEC_1  $GAPFEM_SPEC_1  black_mfg  mfg  all_men_mfg  IV_mfg_1960 {
gen    delta_`varb1' =  `varb1' -  `varb1'[_n-1]  if metarea==metarea[_n-1] & `varb1'~=.  & `varb1'[_n-1]~=.
replace      `varb1'  =  delta_`varb1'
}


global  SPEC_1            "              age_25_34          age_35_44          age_45_55   i.year"
global  BLACK_SPEC_1      "        black_age_25_34    black_age_35_44    black_age_45_55   i.year"
global  ALL_SPEC_1        "      all_men_age_25_34  all_men_age_35_44  all_men_age_45_55   i.year"

global  FEM_SPEC_1        "           fem_age_25_34       fem_age_35_44       fem_age_45_55   i.year"
global  BLACKFEM_SPEC_1   "      blackfem_age_25_34  blackfem_age_35_44  blackfem_age_45_55   i.year"

global     GAP_SPEC_1            "        gap_age_25_34       gap_age_35_44       gap_age_45_55   i.year"
global  GAPFEM_SPEC_1            "     gapfem_age_25_34    gapfem_age_35_44    gapfem_age_45_55   i.year"





**********
* BLACKS
**********

global MEN_VARBS   "black_lincwage  black_emprate  black_nevermar"
global FEM_VARBS   "blackfem_nevermar  blackfem_poor  blackfem_single_mom  black_CHILD_poor  black_CHILD_one_parent"

foreach varb1 in $MEN_VARBS  $FEM_VARBS  {
gen    delta_`varb1' =  `varb1' -  `varb1'[_n-1]  if metarea==metarea[_n-1] & `varb1'~=.  & `varb1'[_n-1]~=.
replace      `varb1'  =  delta_`varb1'
}



* BLACKS - OLS

foreach varb1  in    $MEN_VARBS    {
xi:   reg      `varb1'       black_mfg                              $BLACK_SPEC_1                           if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)   
}
foreach varb1  in    $FEM_VARBS    {
xi:   reg      `varb1'       black_mfg                              $BLACKFEM_SPEC_1                        if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)   
}


* BLACKS - IV

foreach varb1  in    $MEN_VARBS    {
xi:   ivreg2    `varb1'      (black_mfg = IV_mfg_1960)           $BLACK_SPEC_1               if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   ivreg2    `varb1'      (black_mfg = IV_mfg_1960)           $BLACKFEM_SPEC_1            if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)     
}


**********
* WHITES
**********


global MEN_VARBS   "lincwage  emprate  nevermar"
global FEM_VARBS   "fem_nevermar  fem_poor  fem_single_mom  CHILD_poor  CHILD_one_parent"

foreach varb1 in $MEN_VARBS  $FEM_VARBS  {
gen    delta_`varb1' =  `varb1' -  `varb1'[_n-1]  if metarea==metarea[_n-1] & `varb1'~=.  & `varb1'[_n-1]~=.
replace      `varb1'  =  delta_`varb1'
}



* Whites - OLS

foreach varb1  in    $MEN_VARBS    {
xi:   reg      `varb1'       mfg                              $SPEC_1                           if year>=1960  $WHITE_SAMPLE,  robust cluster($FE_LEVEL)   
}
foreach varb1  in    $FEM_VARBS    {
xi:   reg      `varb1'       mfg                              $FEM_SPEC_1                        if year>=1960  $WHITE_SAMPLE,  robust cluster($FE_LEVEL)   
}


* Whites - IV

foreach varb1  in    $MEN_VARBS    {
xi:   ivreg2    `varb1'      (mfg = IV_mfg_1960)           $SPEC_1               if year>=1960  $WHITE_SAMPLE,  robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   ivreg2    `varb1'      (mfg = IV_mfg_1960)           $FEM_SPEC_1            if year>=1960  $WHITE_SAMPLE, robust cluster($FE_LEVEL)     
}


**********
* GAP  
**********



global MEN_VARBS      "gap_lincwage  gap_emprate  gap_nevermar"
global FEM_VARBS      "gapfem_nevermar  gapfem_poor  gapfem_single_mom  "
global CHILD_VARBS    "gap_CHILD_poor  gap_CHILD_one_parent"


foreach varb1 in $MEN_VARBS  $FEM_VARBS  $CHILD_VARBS {
gen    delta_`varb1' =  `varb1' -  `varb1'[_n-1]  if metarea==metarea[_n-1] & `varb1'~=.  & `varb1'[_n-1]~=.
replace      `varb1'  =  delta_`varb1'
}


global  MFG_VARB  "all_men_mfg"

							
* GAP - OLS

foreach varb1  in    $MEN_VARBS    {
xi:   reg      `varb1'       $MFG_VARB                              $GAP_SPEC_1                                          if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)   
}
foreach varb1  in    $FEM_VARBS    {
xi:   reg      `varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)   
}
foreach varb1  in    $CHILD_VARBS  {
xi:   reg      `varb1'       $MFG_VARB                              $GAPFEM_SPEC_1                                       if year>=1960  $BLACK_SAMPLE,  robust cluster($FE_LEVEL)   
}




* GAP - IV

foreach varb1  in    $MEN_VARBS    {
xi:   ivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAP_SPEC_1                                          if year>=1960  $BLACK_SAMPLE,   robust cluster($FE_LEVEL)     
}
foreach varb1  in    $FEM_VARBS    {
xi:   ivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAPFEM_SPEC_1                                       if year>=1960   $BLACK_SAMPLE,  robust cluster($FE_LEVEL)     
}
foreach varb1  in    $CHILD_VARBS  {
xi:   ivreg2    `varb1'      ($MFG_VARB = IV_mfg_1960)           $GAPFEM_SPEC_1                                       if year>=1960   $BLACK_SAMPLE,  robust cluster($FE_LEVEL)     
}



